export default defineNuxtRouteMiddleware((to, from) => {
  // console.log("请求拦截");

  if (to.path == "/login" || to.path=="/register") {
    return;
  }

  if (to.fullPath.includes("/")) {
    // console.log( "cookie", useCookie("userinfo"));
    const cookies = useCookie("token"); // 使用 context
    // console.log(cookies.value);

    if (!cookies.value) { 
      // console.log("需要拦截");
      // navigator("/admin/login")
      return navigateTo("/login");
    }
  }
}); 
